<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Tabs</title>
<style>
	#tab-holder{
		width: 300px;
		margin: 20px auto;
		border: 1px solid #d2d2d2;
	}
	.handle{
		height: 30px;
		line-height: 30px;
	}
	.handle a{
		background-color: #d2d2d2;
		color: #333;
		text-decoration: none;
		float: left;
		width: 98px;
		text-align: center;
		border: 1px solid #d2d2d2;
	}
	a.current{
		border: 1px solid #d2d2d2;
		border-bottom: 1px solid #fff;
		background-color: #fff;
	}
	.show{
		clear: both;
		padding: .5em;
	}
	.show-inner{
		display: none;
	} 
	.show .current{
		display: block;
	}
</style>
<script src="selector.js"></script>
<script src="event.js"></script>
</head>
<body>
	<div id="tab-holder">
		<div class="handle">
			<a href="#show1">选项1</a>
			<a href="#show2" class="current">选项2</a>
			<a href="#show3">选项3</a>
		</div>
		<div class="show">
			<div id="show1" class="show-inner">1. 卧室内容卧室内容</div>
			<div id="show2" class="show-inner current">2. 卧室内容卧室内容卧室内容卧室内容卧室内容卧室内容卧室内容卧室内容</div>
			<div id="show3" class="show-inner">3. 卧室内容卧室内容卧室内容卧室内容卧室内容卧室内容卧室内容卧室内容卧室内容卧室内容卧室内容卧室内容卧室内容卧室内容卧室内容卧室内容</div>
		</div>
	</div>
<script>
	var handles = $("a", $(".handle")[0]),
		shows = $(".show-inner");

	on(handles,'click',function(){

		for (var i = 0; i < shows.length; i++) {
			handles[i].className = "";
			shows[i].className = "show-inner";
		}


		var href = this.getAttribute( "href" );
		$(href)[0].className = "show-inner current";
		this.className = "current";
	});
</script>
</body>
</html>